package org.shj.spark.core

import org.apache.spark.SparkConf
import org.apache.spark.SparkContext

object BroadcastTest {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf
    conf.setAppName("BroadcastTest").setMaster("local")
    val sc = new SparkContext(conf)
    
    val num = 3
    val broadcastNum = sc.broadcast(num)
    
    val data = sc.parallelize(1 to 10)
    val mapRdd =data.map(_ * broadcastNum.value)
    
    mapRdd.foreach(println)
    
    sc.stop()
  }
}